home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat2 / standard / select.z / select
Encoding:
Text File  |  2002-10-03  |  7.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. SSSSEEEELLLLEEEECCCCTTTT((((2222))))                                                            SSSSEEEELLLLEEEECCCCTTTT((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      select - synchronous I/O multiplexing
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<uuuunnnniiiissssttttdddd....hhhh>>>>
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<bbbbssssttttrrrriiiinnnngggg....hhhh>>>>
  15.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttiiiimmmmeeee....hhhh>>>>
  16.  
  17.      iiiinnnntttt sssseeeelllleeeecccctttt ((((iiiinnnntttt nnnnffffddddssss,,,, ffffdddd____sssseeeetttt ****rrrreeeeaaaaddddffffddddssss,,,, ffffdddd____sssseeeetttt ****wwwwrrrriiiitttteeeeffffddddssss,,,,
  18.                ffffdddd____sssseeeetttt ****eeeexxxxcccceeeeppppttttffffddddssss,,,, ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttiiiimmmmeeeeoooouuuutttt))));;;;
  19.  
  20.      FFFFDDDD____SSSSEEEETTTT((((ffffdddd,,,, &&&&ffffddddsssseeeetttt))))
  21.      FFFFDDDD____CCCCLLLLRRRR((((ffffdddd,,,, &&&&ffffddddsssseeeetttt))))
  22.      FFFFDDDD____IIIISSSSSSSSEEEETTTT((((ffffdddd,,,, &&&&ffffddddsssseeeetttt))))
  23.      FFFFDDDD____ZZZZEEEERRRROOOO((((&&&&ffffddddsssseeeetttt))))
  24.      iiiinnnntttt ffffdddd;;;;
  25.      ffffdddd____sssseeeetttt ffffddddsssseeeetttt;;;;
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      _S_e_l_e_c_t examines the I/O descriptor sets whose addresses are passed in
  29.      _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s to see if some of their descriptors are
  30.      ready for reading, are ready for writing, or have an exceptional
  31.      condition pending, respectively.  The first _n_f_d_s file descriptors are
  32.      checked in each set; i.e. the file descriptors from 0 through _n_f_d_s - 1
  33.      will be examined (see _gggg_eeee_tttt_dddd_tttt_aaaa_bbbb_llll_eeee_hhhh_iiii(3) for largest open descriptor).  On
  34.      return, _s_e_l_e_c_t replaces the given descriptor sets with subsets consisting
  35.      of those descriptors that are ready for the requested operation.  The
  36.      total number of ready descriptors in all the sets is the return value.
  37.  
  38.      The descriptor sets are stored as bit fields in arrays of integers.  The
  39.      following macros are provided for manipulating such descriptor sets:
  40.      _F_D__Z_E_R_O(&_f_d_s_e_t) initializes a descriptor set _f_d_s_e_t to the null set.
  41.      _F_D__S_E_T(_f_d, &_f_d_s_e_t) includes a particular descriptor _f_d in _f_d_s_e_t.
  42.      _F_D__C_L_R(_f_d, &_f_d_s_e_t) removes _f_d from _f_d_s_e_t.  _F_D__I_S_S_E_T(_f_d, &_f_d_s_e_t) is
  43.      nonzero if _f_d is a member of _f_d_s_e_t, zero otherwise.  The behavior of
  44.      these macros is undefined if a descriptor value is less than zero or
  45.      greater than or equal to _F_D__S_E_T_S_I_Z_E, which is normally at least equal to
  46.      the maximum number of descriptors supported by the system.
  47.  
  48.      If _t_i_m_e_o_u_t is a non-zero pointer, it specifies a maximum interval to wait
  49.      for the selection to complete.  If _t_i_m_e_o_u_t is a zero pointer, the select
  50.      blocks indefinitely.  To effect a poll, the _t_i_m_e_o_u_t argument should be
  51.      non-zero, pointing to a zero-valued timeval structure.
  52.  
  53.      Any of _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s may be given as zero pointers if
  54.      no descriptors are of interest.
  55.  
  56. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  57.      _S_e_l_e_c_t returns the number of ready descriptors that are contained in the
  58.      descriptor sets, or -1 if an error occurred.  If the time limit expires
  59.      then _s_e_l_e_c_t returns 0.  If _s_e_l_e_c_t returns with an error, including one
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSEEEELLLLEEEECCCCTTTT((((2222))))                                                            SSSSEEEELLLLEEEECCCCTTTT((((2222))))
  71.  
  72.  
  73.  
  74.      due to an interrupted call, the descriptor sets will be unmodified.
  75.  
  76. EEEERRRRRRRROOOORRRRSSSS
  77.      An error return from _s_e_l_e_c_t indicates:
  78.  
  79.      [EBADF]        One of the descriptor sets specified an invalid
  80.                     descriptor.
  81.  
  82.      [EINTR]        A signal was delivered before the time limit expired and
  83.                     before any of the selected events occurred.
  84.  
  85.      [EINVAL]       The specified time limit is invalid.  One of its
  86.                     components is negative or too large.
  87.  
  88. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  89.      poll(2), accept(2), connect(2), read(2), write(2), recv(2), send(2),
  90.      getdtablehi(3C).
  91.  
  92. NNNNOOOOTTTTEEEESSSS
  93.      Some devices do not support polling via the _s_e_l_e_c_t(2) and _p_o_l_l(2) system
  94.      calls.  Doing a _s_e_l_e_c_t or _p_o_l_l on a file descriptor associated with an
  95.      "un-pollable" device will cause the _s_e_l_e_c_t or _p_o_l_l to return immediately
  96.      with a success value of 0 and the with the corresponding file descriptor
  97.      events of queried set true.  For instance, if a _s_e_l_e_c_t or _p_o_l_l is
  98.      performed on a read file descriptor associated with an un-pollable
  99.      device, the call would return immediately, even though there may be
  100.      nothing to read on the device.  A subsequent _r_e_a_d(2) in this situation
  101.      might return with a "bytes-read" count of 0 or might block if the device
  102.      supports read blocking.  Devices which exhibit this behavior (especially
  103.      those from third-party vendors) should be suspected as not supporting
  104.      polling.
  105.  
  106. BBBBUUUUGGGGSSSS
  107.      _S_e_l_e_c_t should probably return the time remaining from the original
  108.      timeout, if any, by modifying the time value in place.  This may be
  109.      implemented in future versions of the system.  Thus, it is unwise to
  110.      assume that the timeout value will be unmodified by the _s_e_l_e_c_t call.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.